function [ R,L ] = do_retinex( I,T )
%DO_RETINEX Summary of this function goes here
%   Detailed explanation goes here

    log_I = log(I);
    
    [Ix,Iy] = ImageDerivatives(log_I);
    
    norm_d = sqrt(Ix.^2 + Iy.^2);
    
    Ix(norm_d < T) = 0;
    Iy(norm_d < T) = 0;
    
    lap = Deriv2Laplace(Ix,Iy);
    invK = invDel2(size(I));
    
    log_R = conv2(lap,invK,'same');
    
    R = exp(log_R);
    L = I./R;
    

end

